package HostComm;

/**
 * 
 * @author Dakota Brown, Travis Shuff
 * 
 * Thread Class that checks the timestamp of all the Clients
 * 
 * @since 09/30/11
 */

public class QueueHost implements Runnable {
    HostDBComm dbComm;
    boolean isAlive = true;

    /**
     * Constructor: Allows Thread to communicate with the database
     * 
     * @since 09/30/11
     */
    public QueueHost() {
        dbComm = new HostDBComm();
    }

    /**
     * Begins checking the timestamps in the Queue table every 6 seconds.
     * 
     * @since 09/30/11
     */
    public void run() {
        while (isAlive && HostDBComm.isConnected()) {
            dbComm.checkStamp();
            
            try {
                Thread.sleep(6000);
            } catch (InterruptedException ex) {
            }
        }
    }
    
    /**
     * Stops the Thread
     * 
     * @since 09/30/11
     */
     public void stop() {
         isAlive = false;
     }
    
    
}
